package org.sfx.util

import javafx.beans.InvalidationListener
import javafx.beans.Observable
import javafx.scene.input.MouseEvent
import javafx.event.EventHandler

object Conversions {
  implicit def f2InvalidationListener(f: Observable => Unit): InvalidationListener = {
    new InvalidationListener() {
      override def invalidated(paramObservable: Observable): Unit = {
        f(paramObservable)
      }
    }
  }
  
  implicit def f2MouseEventHandler(f: MouseEvent => Unit): EventHandler[MouseEvent] = {
    new EventHandler[MouseEvent]() {
      override def handle(event: MouseEvent): Unit = {
        f(event)
      }
    }
  }
}
